package com.ugrow.ugrowcommunity.activity.moments.adapter;

import androidx.recyclerview.widget.DiffUtil;



import java.util.List;

public class DiffCallBack<T> extends DiffUtil.Callback {
    private List<T> mOldData, mNewData;

    public DiffCallBack(List<T> mOldDatas, List<T> mNewDatas) {
        this.mOldData = mOldDatas;
        this.mNewData = mNewDatas;
    }

    @Override
    public int getOldListSize() {
        return mOldData != null ? mOldData.size() : 0;
    }

    @Override
    public int getNewListSize() {
        return mNewData != null ? mNewData.size() : 0;
    }
    @Override
    public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
        return true;
    }
    @Override
    public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
        return mNewData.get(newItemPosition).toString().equals(mOldData.get(oldItemPosition).toString());
    }
}